package com.caizongzhen.www.service;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.caizongzhen.www.entity.User;
import com.caizongzhen.www.mapper.UserMapper;
import org.springframework.stereotype.Service;

@Service
public class UserService extends ServiceImpl<UserMapper,User> {
    public User findUserByUserAccount(User user){
        LambdaQueryWrapper<User> lambdaQueryWrapper = new LambdaQueryWrapper<>();
        lambdaQueryWrapper.eq(User::getUserAccount,user.getUserAccount());
        return this.getOne(lambdaQueryWrapper);
    }

    public User findUserByPwd(String oldPwd){
        LambdaQueryWrapper<User> lambdaQueryWrapper = new LambdaQueryWrapper<>();
        lambdaQueryWrapper.eq(User::getUserPwd,oldPwd);
        return this.getOne(lambdaQueryWrapper);
    }

}
